package com.qidianit.mes.device.controller;

import com.qidianit.common.pojo.MESResult;
import com.qidianit.mes.device.service.ToolsTypeService;
import com.qidianit.mes.pojo.MesToolsType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/toolsType")
@CrossOrigin
public class ToolsTypeController {

        @Autowired
        ToolsTypeService toolsTypeService;
        @GetMapping("/list")
        public MESResult list(String typeCode,String typeName,Integer maintenanceType,
                @RequestParam(defaultValue = "1")int page,
                @RequestParam(defaultValue = "10")int limit) {
            MESResult mesResult = toolsTypeService.list(typeCode,typeName,maintenanceType,page,limit);
            return mesResult;
        }

        @PostMapping("/add")
        public MESResult add(@RequestBody MesToolsType mesToolsType){
            return toolsTypeService.add(mesToolsType);
        }
        @PostMapping("/edit")
        public MESResult edit(@RequestBody MesToolsType mesToolsType){
            return toolsTypeService.edit(mesToolsType);
        }
        @DeleteMapping("/delete")
        public MESResult delete(String id){
            return toolsTypeService.delete(id);
        }
}
